package com.visualize.demo.controller;

import com.visualize.demo.model.JsonResponse;
import com.visualize.demo.service.AccountService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TotalController {

    private final AccountService accountService;

    public TotalController(AccountService accountService) {
        this.accountService = accountService;
    }

    @ResponseBody
    @GetMapping("api/index")
    public JsonResponse showProjectList() {
        return accountService.showProjectList();
    }

    @ResponseBody
    @GetMapping("api/total")
    public JsonResponse showPercent(Integer id) {
        return accountService.showPercent(id);
    }
}
